// pages/detailMovie/detailMovie.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    detailMovie:{},
    photos:[],
    activeNames: ['1'],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let id=options.id;
    // this.detailMovie(id);
    let detailMovie = getApp().globalData.movieList.find(it=>it.id==id);
    this.setData({detailMovie});
},
onChange(event) {
  console.log("event:",event)
  this.setData({
    activeNames: event.detail,
  });
},
onShareAppMessage: function (res){
  return {
    title: '电影之家',
    path: '/pages/detailMovie/detailMovie?id='+this.data.detailMovie.id,
  }
},
// detailMovie(id){
//   wx.request({
//     url: 'http://www.h5yjy.com/api/detailmovie?movieId='+id,
//     success:(res)=>{
//       console.log(res)
      
//       var  detailMovie= this.data.detailMovie;
//       detailMovie = res.data.data.detailMovie;
//       detailMovie.img = detailMovie.img.replace("w.h","66.94");

//       for (var index = 0; index < detailMovie.photos.length; index++) {
//         detailMovie.photos[index]= detailMovie.photos[index].replace("w.h","66.94");
//       }
//         this.setData(detailMovie.photos[index]);
         
//       this.setData({detailMovie});
//     }
//   })
// },
  



  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
})